package com.example.demo.controller;

import com.example.demo.model.corder;
import com.example.demo.service.OrderService;
import com.example.demo.service.impl.Orderimpl;
import com.example.demo.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class OrderController extends BaseController{
    @Autowired
    private OrderService orderService;

    @GetMapping("/create")
    public JsonResult<corder> create(/*Integer aid, Integer[] cids, */HttpSession session) throws Orderimpl.InsertException {
        Integer uid = getUidFromSession(session);
        corder data = orderService.create(uid);
        return new JsonResult<>(OK, data);
    }
}
